/**
 * Created by Administrator on 2016/8/4.
 */

$(function(){
    $('.right li:nth-child(2) a:first').hover(function(){
        $('.right li:nth-child(2)').addClass('showadd');
        $('.right li:nth-child(2) div:nth-of-type(2)').css('display','block');
        $('.right li:nth-child(2) div:nth-of-type(2) section a').mouseover(function(){
            $(this).css('color',"#f52648");
        }).mouseout(function(){
            $(this).css('color',"#666");
        })
    });
    $('.right li:nth-child(2)').mouseleave(function(){
        $('.right li:nth-child(2) div:nth-of-type(2)').css('display','none');
        $('.right li:nth-child(2)').removeClass('showadd');
    });

    $('.right li:last-child').mouseover(function(){
        $(this).addClass('showadd');
        $('.right li:last-child section').css('display','block');
    });
    $('.right li:last-child').mouseout(function(){
        $(this).removeClass('showadd');
        $('.right li:last-child section').css('display','none');
    });

    $('form').submit(function(e){
        e.preventDefault();
        var data = $(this).serialize();
        $.post('/login',data,function(res){
            if(res.code == 'success'){
                location.href = '/';
                $('.right li:nth-child(1)').html(petname);
            }else{
                $('.modal-body').text(res.message);
                $('.modal').modal('show');
            }
        })
    })


});

